package com.sunyard.dal.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sunyard.utils.manage.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * 终端预警查询返回实体
 */

@ApiModel
public class TerminalWarningQueryDTO {

    /**
     * 公共返回参数
     */
    @ApiModelProperty(value = "id")
    private Integer id;

    // 终端种类型 0-钥匙终端，1-锁终端
    @ApiModelProperty(value = "终端种类型 0-钥匙终端，1-锁终端")
    private String type;

    // 名称
    @ApiModelProperty(value = "终端名称")
    private String name;

    // 机构名称
    @ApiModelProperty(value = "机构名称")
    private String orgName;

    // 备注
    @ApiModelProperty(value = "备注")
    private String remark;


    /**
     * 终端预警查询返回参数
     */
    // 钥匙种类 1指纹钥匙 2物联网钥匙 3动码钥匙
    @ApiModelProperty(value = "钥匙种类 1指纹钥匙 2物联网钥匙 3动码钥匙")
    private String keyType;

    // mac地址
    @ApiModelProperty(value = "mac地址")
    private String mac;


    // 在线时间
    @ApiModelProperty(value = "上次日期")
    private String lastTime;

    /**
     * 锁具预警查询返回参数
     */
    // 所属机构ID
    @ApiModelProperty(value = "所属机构ID")
    private String orgId;

    // 锁id
    @ApiModelProperty(value = "锁id")
    private String lockId;

    // 锁种类 1主管锁 2柜员锁 3柜员通锁
    @ApiModelProperty(value = "锁种类 1主管锁 2柜员锁 3柜员通锁")
    private String lockType;

    // 场景类型
    @ApiModelProperty(value = "场景类型")
    private String missionType;

    // 复核状态（取消）
    //@ApiModelProperty(value = "复核状态")
    //private String isCheck;

    // 日志翻转
    @ApiModelProperty(value = "日志翻转")
    private String reversion;

    // 创建人
    @ApiModelProperty(value = "创建人编号")
    private String createUser;

    @ApiModelProperty(value = "创建人真实姓名")
    private String createUserRealName;

    // 创建时间
    @ApiModelProperty(value = "创建时间")
    private String createTime;

    private Integer boxId;

    /**
     * 经度
     */
    @ApiModelProperty(value = "经度")
    private String longitude;

    /**
     * 纬度
     */
    @ApiModelProperty(value = "纬度")
    private String latitude;

    /**
     * 锁名称
     */
    @ApiModelProperty(value = "锁名称")
    private String lockName;

    /**
     * 锁状态0关 1开
     */
    @ApiModelProperty(value = "锁状态 0关 1开")
    private String lockStatus;

    /**
     * 门状态0关 1开
     */
    @ApiModelProperty(value = "门状态 0关 1开")
    private String doorStatus;

    /**
     * 操作人
     */
    @ApiModelProperty(value = "操作人")
    private String operateUser;

    /**
     * 预警信息
     */
    @ApiModelProperty(value = "预警信息")
    private String description;

    /**
     * 尾箱编号
     */
    @ApiModelProperty(value = "尾箱编号")
    private String numbers;

    /**
     * 1非越界 2越界
     */
    @ApiModelProperty(value = "预警类型 1非越界 2越界")
    private String alarmType;

    /**
     * 上次开锁时间
     */
    @ApiModelProperty(value = "上次开锁时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyyMM-dd HH:mm:ss")
    private String openLockTime;


    /**
     * 任务id
     */
    @ApiModelProperty(value = "任务id")
    private Integer missionId;

    public String getOpenLockTime() {
        return openLockTime;
    }

    public void setOpenLockTime(String openLockTime) {
        this.openLockTime = openLockTime;
    }

    public Integer getBoxId() {
        return boxId;
    }

    public void setBoxId(Integer boxId) {
        this.boxId = boxId;
    }

    public String getLongitude() {
        return longitude;
    }

    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    public String getLatitude() {
        return latitude;
    }

    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }

    public String getLockName() {
        return lockName;
    }

    public void setLockName(String lockName) {
        this.lockName = lockName;
    }

    public String getLockStatus() {
        return lockStatus;
    }

    public void setLockStatus(String lockStatus) {
        this.lockStatus = lockStatus;
    }

    public String getDoorStatus() {
        return doorStatus;
    }

    public void setDoorStatus(String doorStatus) {
        this.doorStatus = doorStatus;
    }

    public String getOperateUser() {
        return operateUser;
    }

    public void setOperateUser(String operateUser) {
        this.operateUser = operateUser;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getNumbers() {
        return numbers;
    }

    public void setNumbers(String numbers) {
        this.numbers = numbers;
    }

    public String getAlarmType() {
        return alarmType;
    }

    public void setAlarmType(String alarmType) {
        this.alarmType = alarmType;
    }

    public Integer getMissionId() {
        return missionId;
    }

    public void setMissionId(Integer missionId) {
        this.missionId = missionId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getKeyType() {
        return keyType;
    }

    public void setKeyType(String keyType) {
        this.keyType = keyType;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public String getLastTime() {
        if (StringUtils.isBlank(lastTime) || "0".equals(lastTime)){
            return "从未上传";
        }else {
            Long timestamp = Long.parseLong(lastTime);
            String date = new SimpleDateFormat(DateUtil.YYYYMMDD_HHMMSS, Locale.CHINA).format(new Date(timestamp));
            return date;
        }
    }

    public void setLastTime(String lastTime) {
        this.lastTime = lastTime;
    }

    public String getOrgId() {
        return orgId;
    }

    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    public String getLockId() {
        return lockId;
    }

    public void setLockId(String lockId) {
        this.lockId = lockId;
    }

    public String getLockType() {
        return lockType;
    }

    public void setLockType(String lockType) {
        this.lockType = lockType;
    }

    public String getMissionType() {
        return missionType;
    }

    public void setMissionType(String missionType) {
        this.missionType = missionType;
    }

    public String getReversion() {
        return reversion;
    }

    public void setReversion(String reversion) {
        this.reversion = reversion;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public String getCreateUserRealName() {
        return createUserRealName;
    }

    public void setCreateUserRealName(String createUserRealName) {
        this.createUserRealName = createUserRealName;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
}
